<?xml version="1.0" encoding="UTF-8"?>
<openerp>
	<data>
		<record id="sale_view_inherit3_max" model="ir.ui.view">
			<field name="name">sale.view.inherit3.max</field>
			<field name="model">sale.order</field>
			<field name="inherit_id" ref="so_workflowchange.sale_view_inherit3"/>
			<field name="arch" type="xml">
				<field name="partner_id" position="replace">
					<field name="partner_id" options='{"quick_create": false}'
						attrs="{'readonly': [('order_line','!=',False)]}"
						on_change="onchange_partner_id(partner_id, partner_id2, order_line)"
						domain="[('customer','=',True)]" context="{'search_default_customer':1}"
						required="1" colspan="4"/>
					<newline/>
				</field>
				<field name="partner_order_id" position="replace">
					<field domain="[('partner_id','=',partner_id)]" name="partner_order_id"
						on_change="onchange_partner_order_id(partner_order_id, partner_invoice_id, partner_shipping_id)"
						options='{"quick_create": false}' colspan="4"/>
				</field>
				<field name="partner_invoice_id" position="replace">
					<field domain="[('partner_id','=',partner_id)]" name="partner_invoice_id" 
					groups="base.group_extended" options='{"quick_create": false}' colspan="4"/>
				</field>
				<field name="partner_shipping_id" position="replace">
					<field domain="[('partner_id','=',partner_id)]" name="partner_shipping_id"
					groups="base.group_extended" options='{"quick_create": false}' colspan="4"/>
				</field>
				<field name="payment_term" position="replace">
					<field name="payment_term" widget="selection" groups="so_workflowchange.group_non_user"/>
				</field>
				<field name="order_policy" position="replace">
					<field name="order_policy" groups="so_workflowchange.group_non_user"/>
				</field>
				<field name="picking_policy" position="replace">
					<field name="picking_policy" required="True" groups="so_workflowchange.group_non_user"/>
				</field>
				<field name="invoice_quantity" position="replace">
					<field name="invoice_quantity" groups="so_workflowchange.group_non_user"/>
				</field>
				<button name="button_dummy" position="replace">
					<button name="button_dummy" states="draft" string="Compute" type="object" icon="gtk-execute" groups="so_workflowchange.group_non_user"/>
				</button>
				<button name="%(sale.action_view_sale_advance_payment_inv)d" position="replace">
					<button name="%(sale.action_view_sale_advance_payment_inv)d" string="Advance Invoice" type="action" icon="gtk-execute" states="draft,manual" groups="so_workflowchange.group_non_user"/>
				</button>
				<field name="invoiced" position="replace">
					<field name="invoiced" groups="so_workflowchange.group_non_user"/>
				</field>
				<separator string="Invoices" position="replace">
					<separator colspan="4" string="Invoices" groups="so_workflowchange.group_non_user"/>
				</separator>
				<field name="invoice_ids" position="replace">
					<field colspan="4" name="invoice_ids" nolabel="1" context="{'form_view_ref':'account.invoice_form'}" groups="so_workflowchange.group_non_user"/>
				</field>
				<xpath expr="/form/notebook/page/field[@name='order_line']/tree/field[@name='name']" position="replace">
					<field colspan="4" name="product_customer_id"/>
					<field colspan="4" name="product_id2"/>
				</xpath>
				<xpath expr="/form/notebook/page/field[@name='order_line']/form/notebook/page/group/field[@name='product_packaging']" position="replace">
					<field name="product_packaging"
						context="{'partner_id':parent.partner_id, 'quantity':product_uom_qty, 'pricelist':parent.pricelist_id, 'shop':parent.shop_id, 'uom':product_uom}"
						on_change="product_packaging_change2(parent.shop_id.company_id,product_customer_id,effective_date,parent.pricelist_id, product_id, product_uom_qty, product_uom, parent.partner_id, product_packaging, True, context)"
						domain="[('product_id','=',product_id)]"
						colspan="3" groups="so_workflowchange.group_non_user"/>
				</xpath>
				<xpath expr="/form/notebook/page/field[@name='order_line']/form/notebook/page/group/field[@name='name']" position="replace">
					<field name="name" groups="so_workflowchange.group_non_user"/>
				</xpath>
				<xpath expr="/form/notebook/page/field[@name='order_line']/form/notebook/page[@string='Extra Info']" position="replace">
					<page groups="so_workflowchange.group_non_user" string="Extra Info">
						<field name="type"/>
						<field name="delay"/>
						<field name="th_weight"/>
						<field name="address_allotment_id"/>
						<separator colspan="4" string="Properties"/>
						<field name="property_ids" colspan="4" nolabel="1"/>
					</page>
				</xpath>
				<xpath expr="/form/notebook/page/field[@name='order_line']/form/notebook/page/group/group/field[@name='discount']" position="replace">
					<field name="discount" readonly="1"/>
				</xpath>
				<xpath expr="/form/notebook/page/field[@name='order_line']/form/notebook/page/group/group/field[@name='invoiced']" position="replace">
					<field name="invoiced" groups="so_workflowchange.group_non_user"/>
				</xpath>
				<xpath expr="/form/notebook/page/field[@name='order_line']/form/notebook/page/group/group/group/button[@name='%(sale.action_view_sale_order_line_make_invoice)d']" position="replace">
					<button colspan="1" name="%(sale.action_view_sale_order_line_make_invoice)d" states="confirmed" string="Make Invoices" type="action" icon="terp-document-new" groups="so_workflowchange.group_non_user"/>
				</xpath>
				<xpath expr="/form/notebook/page/field[@name='order_line']/tree/field[@name='discount']" position="replace">
					<field name="discount" groups="so_workflowchange.group_non_user"/>
				</xpath>
			</field>
		</record>

		<record id="sale_order_tree_max" model="ir.ui.view">
			<field name="name">sale.order.tree.max</field>
			<field name="model">sale.order</field>
			<field name="inherit_id" ref="sale.view_order_tree"/>
			<field name="arch" type="xml">
				<!--field name="amount_total" position="replace"/>
				<field name="amount_untaxed" position="replace">
					<field name="amount_untaxed" sum="Total Tax Excluded" groups="so_workflowchange.group_non_user"/>
					<field name="amount_total" sum="Total Tax Included" groups="so_workflowchange.group_non_user"/>
				</field-->
				<field name="invoiced_rate" position="replace">
					<field name="invoiced_rate" widget="progressbar" groups="so_workflowchange.group_non_user"/>
				</field>
			</field>
		</record>

		<record id="sale_order_search_max" model="ir.ui.view">
			<field name="name">sale.order.search.max</field>
			<field name="model">sale.order</field>
			<field name="inherit_id" ref="sale.view_sales_order_filter"/>
			<field name="arch" type="xml">
				<filter string="To Invoice" position="replace">
					<filter icon="terp-dolar_ok!" string="To Invoice" domain="[('state','=','manual')]" help="Sales Order ready to be invoiced" groups="so_workflowchange.group_non_user"/>
				</filter>
			</field>
		</record>

		<record model='ir.actions.act_window' id='sale.action_sale_order_make_invoice'>
			<field name="groups_id" eval="[(6,0,[ref('so_workflowchange.group_non_user')])]"/>
		</record>

		<record id="base.next_id_64" model="ir.ui.menu">
			<field name="groups_id" eval="[(6,0,[ref('so_workflowchange.group_non_user')])]"/>
		</record>

	</data>
</openerp>